package leetcode.剑指offer.后40;

import leetcode.剑指offer.pojo.TreeNode;
import org.junit.Test;

/**
 * @author :songyaozhang
 * @date :Created 2021/8/2 17:22
 * @description :
 */
public class 剑指_55_二叉树的深度 {
    @Test
    public void test() {
        Solution solution = new Solution();

    }

    class Solution {
        public int maxDepth(TreeNode root) {
            if (root == null) return 0;
            return Math.max(root.left == null ? 0 : maxDepth(root.left),
                    root.right == null ? 0 : maxDepth(root.right))
                    + 1;
        }
    }

}
